package com.ax.api.config.upload.model;


import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.region.Region;

public class CosClientEntity {
    /**
     * secretId
     */
    public static final String secretId = "AKIDsmdP1U3uRrvsf0wIZhePyLWsERbbF3V5";

    /**
     * secretKey
     */
    public static final String secretKey = "d6PkuthzCD8wa2JWZTHvUtiOyNbbUcga";
    /**
     * 设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
     */
    public static final String regionName = "ap-chengdu";
    /**
     * bucket的命名规则为{name}-{appid} ，此处填写的存储桶名称必须为此格式
     */
    public static final String bucketName = "vaccine-1254069518"; //"mybucket-1251668577"

    /**
     * 对象视频key
     */
    public static final String movieKey = "upload/movie/";//String key = "upload_single_demo.txt";
    
    /**
     * 对象图片key
     */
    public static final String imgKey = "upload/img/";

    /**
     * COS存储域名
     */
    public static final String realmName = "http://cos-vc.cdaxkj.cn";
    /**
     * 构造cos客户端
     *
     * @return
     */
    public static COSClient getInstace() {
        // 1 初始化用户身份信息(secretId, secretKey)
        COSCredentials cred = new BasicCOSCredentials(CosClientEntity.secretId, CosClientEntity.secretKey);
        // 2 设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
        ClientConfig clientConfig = new ClientConfig(new Region(CosClientEntity.regionName));
        // 3 生成cos客户端
        return new COSClient(cred, clientConfig);
    }

}
